package com.universal.frame.generalutils.timer;

import android.os.CountDownTimer;
import android.widget.TextView;

/**
 * 计时器
 *
 * @author Administrator
 */
public class TimerCount extends CountDownTimer {

    private TextView text;

    public TimerCount(long millisInFuture, long countDownInterval, TextView text) {
        super(millisInFuture, countDownInterval);
        this.text = text;
    }

    public TimerCount(long millisInFuture, long countDownInterval) {
        super(millisInFuture, countDownInterval);

    }

    @Override
    public void onFinish() {
        text.setClickable(true);
        text.setText("获取验证码");
    }

    @Override
    public void onTick(long millisUntilFinished) {
        text.setClickable(false);
        text.setText(millisUntilFinished / 1000 + "秒重新获取");
    }

}
